# coding=utf-8
# author=haishan09@gmail.com

class BaseAdapter(object):

    def __init__(self):
        self.labels_cache = {}

    def get_dim_label(self, dim_name): 

        from dimension.models import Dimension

        if not self.labels_cache.has_key(dim_name):
            dim_label = Dimension.objects.get(name=dim_name).label.encode('utf-8')
            self.labels_cache[dim_name] = dim_label
        return self.labels_cache[dim_name]

    def get_agg_label(self, agg_name): 

        from aggregate.models import Aggregate

        if not self.labels_cache.has_key(agg_name):
            agg_label = Aggregate.objects.get(name=agg_name).label.encode('utf-8')
            self.labels_cache[agg_name] = agg_label
        return self.labels_cache[agg_name]

    def transform(self, config, source):
        raise NotImplementedError
